package cn.growthgate.fgo.web.result;

import java.util.Collections;
import java.util.List;

import com.baomidou.mybatisplus.plugins.Page;

public class TableResult<T> {

	private int code = 0;

	private String msg = "";

	private long count = 0;

	private List<T> data = Collections.emptyList();

	public TableResult(Page<T> page) {
		this.count = page.getTotal();
		this.data = page.getRecords();
	}

	public TableResult(List<T> list) {
		this.count = list.size();
		this.data = list;
	}

	public TableResult(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public long getCount() {
		return count;
	}

	public void setCount(long count) {
		this.count = count;
	}

	public List<T> getData() {
		return data;
	}

	public void setData(List<T> data) {
		this.data = data;
	}

}
